'''
抓取bing.com的背景图片 。从当前日期开始 向前 n个日期的图图片

注意 #！后的解析器 路径以具体的 python3 路径
for i in range(10) 为抓取的个数
'''
#! /home/kele/anaconda3/bin/python
import requests
from pathlib import Path

def save_pic(path):
	for i in range(10):
		url="http://bingw.jasonzeng.dev?resolution=UHD&index={}".format(i)
		with requests.get(url) as r:
			with open(path/f"{i}.jpg","wb") as w:
				w.write(r.content)

if __name__=="__main__":
	saved_path=Path("bingdownload/bing_pic")
	saved_path.mkdir(parents= True,exist_ok=True)
	save_pic(saved_path)
